const Koa = require("koa");
const bodyParser = require("koa-bodyparser");
const registerRouter = require("../router");
// const userRouter = require("../router/user.router");
// const loginRouter = require("../router/login.router");

// 1.创建koa对象
const app = new Koa();

// 2.使用中间件
app.use(bodyParser());

// 自动化注册路由
registerRouter(app);
// 启用路由
// app.use(userRouter.routes());
// app.use(userRouter.allowedMethods());
// app.use(loginRouter.routes());
// app.use(loginRouter.allowedMethods());

module.exports = app;
